﻿using System.Data.Objects;
using System.Windows.Data;

namespace CoffeeInventory
{
	/// <summary>
	/// Interaction logic for addWarehouseWindow.xaml
	/// </summary>
	public partial class AddWarehouseWindow
	{
		public AddWarehouseWindow()
		{
			InitializeComponent();
			
			// Insert code required on object creation below this point.
		}

		private void WindowLoaded(object sender, System.Windows.RoutedEventArgs e)
		{
			var dBModelContainer = new DBModelContainer();
			// Load data into Suppliers. You can modify this code as needed.
			var suppliersViewSource = ((CollectionViewSource)(FindResource("suppliersViewSource")));
			ObjectQuery<Supplier> suppliersQuery = GetSuppliersQuery(dBModelContainer);
			suppliersViewSource.Source = suppliersQuery.Execute(MergeOption.AppendOnly);
		}

		private ObjectQuery<Supplier> GetSuppliersQuery(DBModelContainer dBModelContainer)
		{
			// Auto generated code
			ObjectQuery<Supplier> suppliersQuery = dBModelContainer.Suppliers;
			// Returns an ObjectQuery.
			return suppliersQuery;
		}
	}
}